package server;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * @author Administrator
 *读取外部数据发送到浏览器
 */
public class ThreadIn extends Thread{
	InputStream is;
	OutputStream os;
	private int id;
	public ThreadIn(InputStream is, OutputStream os,int id) {
		super();
		this.is = is;
		this.os = os;
	}
	
	public void run(){
		byte[] buf = new byte[1024];
		int l;
		try {
			while((l = is.read(buf)) != -1){
				os.write(buf, 0, l);
				os.flush();
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
	//		e.printStackTrace();
			System.out.println("This Input Thread Has Time Out :　" + id);
		}
	}
	
}
